package com.coltsmedia.RichmondHighNews;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;

public class WeatherActivity extends SherlockActivity{

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.weather_layout);
        getActionBar().setDisplayHomeAsUpEnabled(true);
        loadWebView();
    }

    private void loadWebView() {

        String content = "http://m.weather.gc.ca/city/pages/bc-74_e.html";

        WebView weatherView = (WebView) findViewById(R.id.weather_view);

        weatherView.getSettings().setJavaScriptEnabled(true);
        weatherView.loadUrl(content);
        weatherView.setInitialScale(0);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            NavUtils.navigateUpTo(this, new Intent(this, MainMenuActivity.class));
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
